/* $Id$ */
package org.crazydays.gameplan.map.swing;


import org.junit.*;
import static org.junit.Assert.*;

import static org.easymock.EasyMock.*;
import static org.easymock.classextension.EasyMock.*;

import org.crazydays.gameplan.Actions;
import org.crazydays.gameplan.Controller;
import org.crazydays.gameplan.map.event.ToggleGrid;

/**
 * JMapContextMenuUnitTest
 */
public class JMapContextMenuUnitTest
{
    /**
     * Test JMapContextMenu.
     */
    @Test
    public void testJMapContextMenu()
    {
        // mock
        Controller controller = createMock(Controller.class);
        Actions actions = createMock(Actions.class);

        // objects
        ToggleGrid gridToggle = new ToggleGrid(controller);

        // expect
        expect(controller.getActions()).andReturn(actions);
        expect(actions.getToggleGrid()).andReturn(gridToggle);

        // replay
        replay(controller, actions);

        // test
        JMapContextMenu menu = new JMapContextMenu(controller);

        // verify
        verify(controller, actions);

        // TODO: find better way to verify menu
        assertEquals("menu.size", 3, menu.getComponentCount());
    }
}
